﻿using N2.Engine.Globalization;
using N2;

namespace FlexiCommerce.Web.Templates.Layouts
{
    public class Translation
    {
        private ContentItem page;
        private ILanguage language;
        private string overrideUrl;
        public Translation(ContentItem page, ILanguage language)
        {
            this.page = page;
            this.language = language;
        }
        public Translation(ContentItem page, ILanguage language, string overrideUrl)
        {
            this.page = page;
            this.language = language;
            this.overrideUrl = overrideUrl;
        }

        public string Url
        {
            get
            {
                if (!string.IsNullOrEmpty(overrideUrl))
                {
                    return N2.Web.Url.ToAbsolute(overrideUrl);
                }
                else
                {
                    return Page.Url;
                }
            }
        }
        public ContentItem Page
        {
            get { return page; }
            set { page = value; }
        }

        public ILanguage Language
        {
            get { return language; }
            set { language = value; }
        }
    }
}